﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace OrderForm
{
   public partial class SecondForm : Form
   {
      public const int WM_NCLBUTTONDOWN = 0xA1;
      public const int HTCAPTION = 0x2;
      [DllImportAttribute("user32.dll")]
      public static extern bool ReleaseCapture();
      [DllImportAttribute("user32.dll")]
      public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

      #region GLOBALVARIABLES

      private static int cost;
      public string insertOrders;
      public int insertPrice;
      public DateTime deliveryTime = new DateTime();
      static bool done = false;

      #endregion

      public SecondForm()
      {
         InitializeComponent();
         timer1.Start();
         this.FormBorderStyle = FormBorderStyle.None;
         this.MouseDown += new MouseEventHandler(Window_MouseDown);
         SetStyle(ControlStyles.SupportsTransparentBackColor, true);
         this.BackColor = Color.WhiteSmoke;
         this.TransparencyKey = Color.WhiteSmoke;
      }

      private void Window_MouseDown(object sender, MouseEventArgs e)
      {
         if (e.Button == MouseButtons.Left)
         {
            ReleaseCapture();
            SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
         }
      }


      // Completely exit the application
      private void buttonExit_Click_1(object sender, EventArgs e)
      {
         Application.Exit();
      }

      // Minimize window
      private void buttonMinimize_Click(object sender, EventArgs e)
      {
         WindowState = FormWindowState.Minimized;
      }

      // Official logo link
      private void OfficialWebButton_Click(object sender, EventArgs e)
      {
         System.Diagnostics.Process.Start("http://www.mcdonalds.com.tw/");
      }

      private void nextButton1_Click(object sender, EventArgs e)
      {
         this.Hide();
         new ThirdForm().Show();
      }

      private string _name;
      public string name
      {
         get
         {
            return _name;
         }
         set 
         {
            _name = value; 
            welcomeLabel.Text = ("歡迎, " + _name + "!");
            dataGridView1.Rows.Add(name, "--", "--",  DateTime.Now.ToString("HH:mm:ss tt"), "--", "--");
         }
      }

      private string _pwd;
      public string pwd
      {
         get
         {
            return _pwd;
         }
         set 
         { 
            _pwd = value;
            displayPhone.Text = ("您的電話: " + pwd); 
         }
      }

      private string _address;
      public string address
      {
         get
         {
            return _address;
         }
         set 
         { 
            _address = value; 
            displayAdd.Text = ("您的地址: " + _address); 
         }
      }

      private void timer1_Tick(object sender, EventArgs e)
      {
         label1.Text = (Convert.ToInt32(label1.Text) + 1).ToString();
      }

      private void buttonNext2_Click(object sender, EventArgs e)
      {
         ThirdForm form3 = new ThirdForm();
         


         #region hideshit

         this.checkedListBox1.Visible = false;
         this.checkedListBox2.Visible = false;
         this.checkedListBox3.Visible = false;
         this.checkedListBox4.Visible = false;
         this.checkedListBox5.Visible = false;
         this.checkedListBox6.Visible = false;
         this.checkBox1.Visible = false;
         this.checkBox2.Visible = false;
         this.label2.Visible = false;
         this.label3.Visible = false;
         this.label4.Visible = false;
         this.label5.Visible = false;
         this.label6.Visible = false;
         this.label7.Visible = false;
         this.label8.Visible = false;
         this.button1.Visible = false;
         this.buttonNext2.Visible = false;

         this.dataGridView1.Visible = true;
         this.displayAdd.Visible = true;
         this.displayPhone.Visible = true;
         this.nextButton1.Visible = true;

         #endregion
         //form3.Show();
      }


      private void button1_Click(object sender, EventArgs e)
      {

         #region CheckTime

         TimeSpan currentTime = DateTime.Now.TimeOfDay;

         TimeSpan noonStart = new TimeSpan(11, 0, 0);
         TimeSpan noonEnd = new TimeSpan(14, 0, 0);

         TimeSpan nightStart = new TimeSpan(17, 0, 0);
         TimeSpan nightEnd = new TimeSpan(20, 0, 0);

         TimeSpan morningStart = new TimeSpan(4, 0, 0);
         TimeSpan morningEnd = new TimeSpan(10, 30, 0);

         #endregion

         string result = "";
         SecondForm.cost = 0;
         if ((currentTime > noonStart) && (currentTime < noonEnd))
         {
            for (int x = 0; x < checkedListBox2.CheckedItems.Count; x++)
            {
               
               string text = checkedListBox2.GetItemText(checkedListBox2.CheckedItems[x]);
               result = result + "," + text;
               switch (text)
               {
                  case "大麥克餐99元":
                     cost += 99;
                     insertOrders = "大麥克餐";
                     insertPrice = 99;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "雙層牛肉吉士堡餐79元":
                     cost += 79;
                     insertOrders = "雙層牛肉吉士堡餐";
                     insertPrice = 79;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "四盎司牛肉堡餐119元":
                     cost += 119;
                     insertOrders = "四盎司牛肉堡餐";
                     insertPrice = 119;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "麥香魚餐79元":
                     cost += 79;
                     insertOrders = "麥香魚餐";
                     insertPrice = 79;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "麥香雞餐79元":
                     cost += 79;
                     insertOrders = "麥香雞餐";
                     insertPrice = 79;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;               
                  case "麥克雞塊餐(6塊)99元":
                     cost += 99;
                     insertOrders = "麥克雞塊餐(6塊)";
                     insertPrice = 99;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "勁辣雞腿堡餐99元":
                     cost += 99;
                     insertOrders = "勁辣雞腿堡餐";
                     insertPrice = 99;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "麥脆雞餐(二塊)119元":
                     cost += 119;
                     insertOrders = "麥脆雞餐(二塊)";
                     insertPrice = 119;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "板烤雞腿堡餐99元":
                     cost += 99;
                     insertOrders = "板烤雞腿堡餐";
                     insertPrice = 99;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;                         
                  default:
                     cost = 0;
                     break;
               }
            }
            if ((checkBox1.Checked == true ) && (checkBox2.Checked == true))
            {
               cost+=15;
            }
            else if (checkBox1.Checked == true)
            {
               cost += 10;
            }
            else if (checkBox2.Checked == true)
            {
               cost += 5;
            }
            else 
            {
               ;
            }
         }
         else if ((currentTime > nightStart) && (currentTime < nightEnd))
         {
            for (int x = 0; x < checkedListBox2.CheckedItems.Count; x++)
            {
               string text = checkedListBox2.GetItemText(checkedListBox2.CheckedItems[x]);
               result = result + "," + text;
               switch (text)
               {
                  case "大麥克餐99元":
                     cost += 99;
                     insertOrders = "大麥克餐";
                     insertPrice = 99;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "雙層牛肉吉士堡餐79元":
                     cost += 79;
                     insertOrders = "雙層牛肉吉士堡餐";
                     insertPrice = 79;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "四盎司牛肉堡餐119元":
                     cost += 119;
                     insertOrders = "四盎司牛肉堡餐";
                     insertPrice = 119;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "麥香魚餐79元":
                     cost += 79;
                     insertOrders = "麥香魚餐";
                     insertPrice = 79;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "麥香雞餐79元":
                     cost += 79;
                     insertOrders = "麥香雞餐";
                     insertPrice = 79;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "麥克雞塊餐(6塊)99元":
                     cost += 99;
                     insertOrders = "麥克雞塊餐(6塊)";
                     insertPrice = 99;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "勁辣雞腿堡餐99元":
                     insertOrders = "勁辣雞腿堡餐";
                     insertPrice = 99;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     cost += 99;
                     break;
                  case "麥脆雞餐(二塊)119元":

                     cost += 119;
                     insertOrders = "麥脆雞餐(二塊)";
                     insertPrice = 119;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "板烤雞腿堡餐99元":
                     cost += 99;
                     insertOrders = "板烤雞腿堡餐";
                     insertPrice = 99;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);

                     break;
                  default:
                     cost = 0;
                     break;
               }
            }
            if ((checkBox1.Checked == true) && (checkBox2.Checked == true))
            {
               cost += 15;
            }
            else if (checkBox1.Checked == true)
            {
               cost += 10;
            }
            else if (checkBox2.Checked == true)
            {
               cost += 5;
            }
            else
            {
               ;
            }
         }
         else
         {
            for (int x = 0; x < checkedListBox3.CheckedItems.Count; x++)
            {
               string text3 = checkedListBox3.GetItemText(checkedListBox3.CheckedItems[x]);
               result = result + "," + text3;
               switch (text3)
               {
                  case "大麥克餐129元":
                     cost += 129;
                     insertOrders = "大麥克餐";
                     insertPrice = 129;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "雙層牛肉吉士堡餐115元":
                     cost += 115;
                     insertOrders = "雙層牛肉吉士堡餐";
                     insertPrice = 115;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "四盎司牛肉堡餐132元":
                     cost += 132;
                     insertOrders = "四盎司牛肉堡餐";
                     insertPrice = 132;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "雙層四盎司牛肉堡餐152元":
                     cost += 152;
                     insertOrders = "雙層四盎司牛肉堡餐";
                     insertPrice = 152;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "麥香魚餐112元":
                     cost += 112;
                     insertOrders = "麥香魚餐";
                     insertPrice = 112;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "麥香雞餐105元":
                     cost += 105;
                     insertOrders = "麥香雞餐";
                     insertPrice = 105;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "麥克雞塊餐(6塊)119元":
                     cost += 119;
                     insertOrders = "麥克雞塊餐(6塊)";
                     insertPrice = 119;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "勁辣雞腿堡餐125元":
                     cost += 125;
                     insertOrders = "勁辣雞腿堡餐";
                     insertPrice = 125;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "麥脆雞餐(二塊)139元":
                     cost += 139;
                     insertOrders = "麥脆雞餐(二塊)";
                     insertPrice = 139;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "板烤雞腿堡餐125元":
                     cost += 125;
                     insertOrders = "板烤雞腿堡餐";
                     insertPrice = 125;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  default:
                     cost = 0;
                     break;
               }            
            }
            if ((checkBox1.Checked == true) && (checkBox2.Checked == true))
            {
               cost += 15;
            }
            else if (checkBox1.Checked == true)
            {
               cost += 10;
            }
            else if (checkBox2.Checked == true)
            {
               cost += 5;
            }
            else
            {
               ;
            }
         }

         if ((currentTime > morningStart) && (currentTime < morningEnd))
         {
            for (int x = 0; x < checkedListBox1.CheckedItems.Count; x++)
            {
               string text = checkedListBox1.GetItemText(checkedListBox1.CheckedItems[x]);
               result = result + "," + text;
               switch (text)
               {
                  case "滿福堡餐77元":
                     cost += 77;
                     insertOrders = "滿福堡餐";
                     insertPrice = 77;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "豬肉滿福堡餐69元":
                     cost += 69;
                     insertOrders = "豬肉滿福堡餐";
                     insertPrice = 69;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "豬肉滿福堡加蛋餐82元":
                     cost += 82;
                     insertOrders = "豬肉滿福堡加蛋餐";
                     insertPrice = 82;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "火腿蛋堡餐75元":
                     cost += 75;
                     insertOrders = "火腿蛋堡餐";
                     insertPrice = 75;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "滿福鮮蔬堡餐79元":
                     cost += 79;
                     insertOrders = "滿福鮮蔬堡餐";
                     insertPrice = 79;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "鮮蔬火腿蛋堡餐79元":
                     cost += 79;
                     insertOrders = "鮮蔬火腿蛋堡餐";
                     insertPrice = 79;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "滿福香雞堡餐69元":
                     cost += 69;
                     insertOrders = "滿福香雞堡餐";
                     insertPrice = 69;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "哈姆吉事堡餐69元":
                     cost += 69;
                     insertOrders = "哈姆吉事堡餐";
                     insertPrice = 69;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "鬆餅餐82元":
                     cost += 82;
                     insertOrders = "鬆餅餐";
                     insertPrice = 82;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "豬肉鬆餅餐89元":
                     cost += 89;
                     insertOrders = "豬肉鬆餅餐";
                     insertPrice = 89;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "經典大早餐99元":
                     cost += 99;
                     insertOrders = "經典大早餐";
                     insertPrice = 99;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  default:
                     cost = 0;
                     break;
               }
            }           
         }
         else
         {
            ;
         }
         if ((currentTime > morningStart) && (currentTime < morningEnd))
         {
            for (int x = 0; x < checkedListBox4.CheckedItems.Count; x++)
            {
               string text = checkedListBox4.GetItemText(checkedListBox4.CheckedItems[x]);
               result = result + "," + text;
               switch (text)
               {
                  case "滿福堡42元":
                     cost += 42;
                     insertOrders = "滿福堡";
                     insertPrice = 42;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "豬肉滿福堡40元":
                     cost += 40;
                     insertOrders = "豬肉滿福堡";
                     insertPrice = 40;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "豬肉滿福堡加蛋49元":
                     cost += 49;
                     insertOrders = "豬肉滿福堡加蛋";
                     insertPrice = 49;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "火腿蛋堡40元":
                     cost += 40;
                     insertOrders = "火腿蛋堡";
                     insertPrice = 40;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "滿福鮮蔬堡45元":
                     cost += 45;
                     insertOrders = "滿福鮮蔬堡";
                     insertPrice = 45;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "鮮蔬火腿蛋堡45元":
                     cost += 45;
                     insertOrders = "鮮蔬火腿蛋堡";
                     insertPrice = 45;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "滿福香雞堡39元":
                     cost += 39;
                     insertOrders = "滿福香雞堡";
                     insertPrice = 39;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "哈姆吉事堡39元":
                     cost += 39;
                     insertOrders = "哈姆吉事堡";
                     insertPrice = 39;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "鬆餅49元":
                     cost += 49;
                     insertOrders = "鬆餅";
                     insertPrice = 49;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "豬肉鬆餅55元":
                     cost += 55;
                     insertOrders = "豬肉鬆餅";
                     insertPrice =55;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "經典大早餐75元":
                     cost += 75;
                     insertOrders = "經典大早餐";
                     insertPrice = 75;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  default:
                     cost = 0;
                     break;
               }
            }
         }
         else
         {
            for (int x = 0; x < checkedListBox5.CheckedItems.Count; x++)
            {
               string text = checkedListBox5.GetItemText(checkedListBox5.CheckedItems[x]);
               result = result + "," + text;
               switch (text)
               {
                  case "大麥克79元":
                     cost += 79;
                     insertOrders = "大麥克";
                     insertPrice = 79;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "雙層牛肉吉士堡75元":
                     cost += 75;
                     insertOrders = "雙層牛肉吉士堡";
                     insertPrice = 75;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "四盎司牛肉堡82元":
                     cost += 82;
                     insertOrders = "四盎司牛肉堡";
                     insertPrice = 82;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "雙層四盎司牛肉堡102元":
                     cost += 102;
                     insertOrders = "雙層四盎司牛肉堡";
                     insertPrice = 102;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "麥香魚75元":
                     cost += 75;
                     insertOrders = "麥香魚";
                     insertPrice = 75;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "麥香雞39元":
                     cost += 39;
                     insertOrders = "麥香雞";
                     insertPrice =39;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "麥克雞塊(6塊)75元":
                     cost += 75;
                     insertOrders = "麥克雞塊(6塊)";
                     insertPrice = 75;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "勁辣雞腿堡75元":
                     cost += 75;
                     insertOrders = "勁辣雞腿堡";
                     insertPrice = 75;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "麥脆雞(二塊)45元":
                     cost += 45;
                     insertOrders = "麥脆雞(二塊)";
                     insertPrice = 45;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  case "板烤雞腿堡79元":
                     cost += 79;
                     insertOrders = "板烤雞腿堡";
                     insertPrice = 79;
                     dataGridView1.Rows.Add("",insertOrders, insertPrice);
                     break;
                  default:
                     cost = 0;
                     break;
               }
            }
         }
         for (int x = 0; x < checkedListBox6.CheckedItems.Count; x++)
         {
            string text = checkedListBox6.GetItemText(checkedListBox6.CheckedItems[x]);
            result = result + "," + text;
            switch (text)
            {
               case "經典美式咖啡	(小)33元":
                  cost += 33;
                  insertOrders = "經典美式咖啡(小)";
                  insertPrice = 33;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "焦糖熱奶茶	(中)43元":
                  cost += 43;
                  insertOrders = "焦糖熱奶茶(中)";
                  insertPrice =43;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "熱巧克力/熱紅茶	       33元":
                  cost += 33;
                  insertOrders = "熱巧克力/熱紅茶";
                  insertPrice = 33;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "經典冰咖啡/焦糖冰奶茶43元":
                  cost += 43;
                  insertOrders = "經典冰咖啡/焦糖冰奶茶43";
                  insertPrice = 43;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "可口可樂	(兒)23元":
                  cost += 23;
                  insertOrders = "可口可樂	(兒)";
                  insertPrice = 23;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "可口可樂zero	(小)28元":
                  cost += 28;
                  insertOrders = "可口可樂zero(小)";
                  insertPrice = 28;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "雪碧/雀巢檸檬茶	(中)33元":
                  cost += 33;
                  insertOrders = "雪碧/雀巢檸檬茶(中)";
                  insertPrice = 33;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "爽健美茶	(大)38元":
                  cost += 38;
                  insertOrders = "爽健美茶	(大)";
                  insertPrice = 38;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "柳橙汁		(小)38元":
                  cost += 38;
                  insertOrders = "柳橙汁(小)";
                  insertPrice = 38;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "柳橙汁		(大)43元":
                  cost += 43;
                  insertOrders = "柳橙汁(大)";
                  insertPrice = 43;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "高鈣鮮乳	     28元":
                  cost += 28;
                  insertOrders = "高鈣鮮乳";
                  insertPrice = 28;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "奶昔		(兒)28元":
                  cost += 28;
                  insertOrders = "奶昔(兒)";
                  insertPrice = 28;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "奶昔		(中)40元":
                  cost += 40;
                  insertOrders = "奶昔(中)";
                  insertPrice = 40;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "冰炫風		       49元":
                  cost += 49;
                  insertOrders = "冰炫風";
                  insertPrice = 49;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "聖代		       28元":
                  cost += 28;
                  insertOrders = "聖代";
                  insertPrice = 28;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "蛋捲冰淇淋	       15元":
                  cost += 15;
                  insertOrders = "蛋捲冰淇淋";
                  insertPrice = 15;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "蘋果派		       25元":
                  cost += 25;
                  insertOrders = "蘋果派";
                  insertPrice = 25;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "漢堡		       32元":
                  cost += 32;
                  insertOrders = "漢堡";
                  insertPrice = 32;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "麥克雙牛堡	       39元":
                  cost += 39;
                  insertOrders = "麥克雙牛堡";
                  insertPrice = 39;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "吉士漢堡	       39元":
                  cost += 39;
                  insertOrders = "吉士漢堡";
                  insertPrice = 39;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "勁辣香雞翅	       39元":
                  cost += 39;
                  insertOrders = "勁辣香雞翅";
                  insertPrice = 39;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "麥克雞塊(4塊)	       55元":
                  cost += 55;
                  insertOrders = "麥克雞塊(4塊)";
                  insertPrice = 55;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "麥克雞塊(6塊)	       75元":
                  cost += 75;
                  insertOrders = "麥克雞塊(6塊)";
                  insertPrice = 75;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "麥克雞塊(9塊)	       95元":
                  cost += 95;
                  insertOrders = "麥克雞塊(9塊)";
                  insertPrice = 95;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "玉米湯		(小)28元":
                  cost += 28;
                  insertOrders = "玉米湯(小)";
                  insertPrice = 28;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "玉米湯		(大)52元":
                  cost += 52;
                  insertOrders = "玉米湯(大)";
                  insertPrice = 52;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "薯條		(小)25元":
                  cost += 25;
                  insertOrders = "薯條(小)";
                  insertPrice = 25;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "薯條		(中)42元":
                  cost += 42;
                  insertOrders = "薯條(中)";
                  insertPrice = 42;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "薯條		(大)52元":
                  cost += 52;
                  insertOrders = "薯條(大)";
                  insertPrice = 52;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "四季水果袋	       39元":
                  cost += 39;
                  insertOrders = "四季水果袋";
                  insertPrice = 39;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "四季沙拉	(小)25元":
                  cost += 25;
                  insertOrders = "四季沙拉	(小)";
                  insertPrice = 25;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "四季沙拉	(大)42元":
                  cost += 42;
                  insertOrders = "四季沙拉	(大)";
                  insertPrice = 42;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               case "薯餅		       25元":
                  cost += 25;
                  insertOrders = "薯餅";
                  insertPrice = 25;
                  dataGridView1.Rows.Add("",insertOrders, insertPrice);
                  break;
               default:
                  cost = 0;
                  break;
            }
         }
         label4.Text = "你花了 " + cost + " 元";

         done = true;
         deliveryTime = DateTime.Now;
         deliveryTime = deliveryTime.AddMinutes(20);
         
         dataGridView1.Rows.Add("", "", "", "", deliveryTime.ToString("HH:mm:ss tt"), cost);
         buttonNext2.Visible = true;
      }
      
      private void dataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
      {
         if (SecondForm.done == true)
         {
            dataGridView1.Rows[e.RowIndex].Cells[5].Style.ForeColor = Color.White;
            dataGridView1.Rows[e.RowIndex].Cells[5].Style.BackColor = Color.DarkRed;
         }
      }

      
   }
}
